3.424 \(\int \tan ^4(c+d x) (a+b \tan (c+d x))^2 \, dx\)

Optimal. Leaf size=120 \[ \frac{\left (a^2-b^2\right ) \tan ^3(c+d x)}{3 d}-\frac{\left (a^2-b^2\right ) \tan (c+d x)}{d}+x \left (a^2-b^2\right )+\frac{a b \tan ^4(c+d x)}{2 d}-\frac{a b \tan ^2(c+d x)}{d}-\frac{2 a b \log (\cos (c+d x))}{d}+\frac{b^2 \tan ^5(c+d x)}{5 d} \]

[Out]

(a^2 - b^2)*x - (2*a*b*Log[Cos[c + d*x]])/d - ((a^2 - b^2)*Tan[c + d*x])/d - (a*b*Tan[c + d*x]^2)/d + ((a^2 -
b^2)*Tan[c + d*x]^3)/(3*d) + (a*b*Tan[c + d*x]^4)/(2*d) + (b^2*Tan[c + d*x]^5)/(5*d)

________________________________________________________________________________________

Rubi [A]  time = 0.167521, antiderivative size = 120, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 4, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.19, Rules used = {3543, 3528, 3525, 3475} \[ \frac{\left (a^2-b^2\right ) \tan ^3(c+d x)}{3 d}-\frac{\left (a^2-b^2\right ) \tan (c+d x)}{d}+x \left (a^2-b^2\right )+\frac{a b \tan ^4(c+d x)}{2 d}-\frac{a b \tan ^2(c+d x)}{d}-\frac{2 a b \log (\cos (c+d x))}{d}+\frac{b^2 \tan ^5(c+d x)}{5 d} \]

Antiderivative was successfully verified.

[In]

Int[Tan[c + d*x]^4*(a + b*Tan[c + d*x])^2,x]

[Out]

(a^2 - b^2)*x - (2*a*b*Log[Cos[c + d*x]])/d - ((a^2 - b^2)*Tan[c + d*x])/d - (a*b*Tan[c + d*x]^2)/d + ((a^2 -
b^2)*Tan[c + d*x]^3)/(3*d) + (a*b*Tan[c + d*x]^4)/(2*d) + (b^2*Tan[c + d*x]^5)/(5*d)

Rule 3543

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
(d^2*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e
 + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1] &&  !(EqQ[m, 2] && EqQ
[a, 0])

Rule 3528

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d
*(a + b*Tan[e + f*x])^m)/(f*m), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \tan ^4(c+d x) (a+b \tan (c+d x))^2 \, dx &=\frac{b^2 \tan ^5(c+d x)}{5 d}+\int \tan ^4(c+d x) \left (a^2-b^2+2 a b \tan (c+d x)\right ) \, dx\\ &=\frac{a b \tan ^4(c+d x)}{2 d}+\frac{b^2 \tan ^5(c+d x)}{5 d}+\int \tan ^3(c+d x) \left (-2 a b+\left (a^2-b^2\right ) \tan (c+d x)\right ) \, dx\\ &=\frac{\left (a^2-b^2\right ) \tan ^3(c+d x)}{3 d}+\frac{a b \tan ^4(c+d x)}{2 d}+\frac{b^2 \tan ^5(c+d x)}{5 d}+\int \tan ^2(c+d x) \left (-a^2+b^2-2 a b \tan (c+d x)\right ) \, dx\\ &=-\frac{a b \tan ^2(c+d x)}{d}+\frac{\left (a^2-b^2\right ) \tan ^3(c+d x)}{3 d}+\frac{a b \tan ^4(c+d x)}{2 d}+\frac{b^2 \tan ^5(c+d x)}{5 d}+\int \tan (c+d x) \left (2 a b-\left (a^2-b^2\right ) \tan (c+d x)\right ) \, dx\\ &=\left (a^2-b^2\right ) x-\frac{\left (a^2-b^2\right ) \tan (c+d x)}{d}-\frac{a b \tan ^2(c+d x)}{d}+\frac{\left (a^2-b^2\right ) \tan ^3(c+d x)}{3 d}+\frac{a b \tan ^4(c+d x)}{2 d}+\frac{b^2 \tan ^5(c+d x)}{5 d}+(2 a b) \int \tan (c+d x) \, dx\\ &=\left (a^2-b^2\right ) x-\frac{2 a b \log (\cos (c+d x))}{d}-\frac{\left (a^2-b^2\right ) \tan (c+d x)}{d}-\frac{a b \tan ^2(c+d x)}{d}+\frac{\left (a^2-b^2\right ) \tan ^3(c+d x)}{3 d}+\frac{a b \tan ^4(c+d x)}{2 d}+\frac{b^2 \tan ^5(c+d x)}{5 d}\\ \end{align*}

Mathematica [A]  time = 0.606124, size = 110, normalized size = 0.92 \[ \frac{10 \left (a^2-b^2\right ) \tan ^3(c+d x)+30 \left (a^2-b^2\right ) \tan ^{-1}(\tan (c+d x))-30 \left (a^2-b^2\right ) \tan (c+d x)+15 a b \tan ^4(c+d x)-30 a b \tan ^2(c+d x)-60 a b \log (\cos (c+d x))+6 b^2 \tan ^5(c+d x)}{30 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[c + d*x]^4*(a + b*Tan[c + d*x])^2,x]

[Out]

(30*(a^2 - b^2)*ArcTan[Tan[c + d*x]] - 60*a*b*Log[Cos[c + d*x]] - 30*(a^2 - b^2)*Tan[c + d*x] - 30*a*b*Tan[c +
 d*x]^2 + 10*(a^2 - b^2)*Tan[c + d*x]^3 + 15*a*b*Tan[c + d*x]^4 + 6*b^2*Tan[c + d*x]^5)/(30*d)

________________________________________________________________________________________

Maple [A]  time = 0.003, size = 153, normalized size = 1.3 \begin{align*}{\frac{{b}^{2} \left ( \tan \left ( dx+c \right ) \right ) ^{5}}{5\,d}}+{\frac{ab \left ( \tan \left ( dx+c \right ) \right ) ^{4}}{2\,d}}+{\frac{{a}^{2} \left ( \tan \left ( dx+c \right ) \right ) ^{3}}{3\,d}}-{\frac{ \left ( \tan \left ( dx+c \right ) \right ) ^{3}{b}^{2}}{3\,d}}-{\frac{ab \left ( \tan \left ( dx+c \right ) \right ) ^{2}}{d}}-{\frac{{a}^{2}\tan \left ( dx+c \right ) }{d}}+{\frac{{b}^{2}\tan \left ( dx+c \right ) }{d}}+{\frac{ab\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) }{d}}+{\frac{{a}^{2}\arctan \left ( \tan \left ( dx+c \right ) \right ) }{d}}-{\frac{\arctan \left ( \tan \left ( dx+c \right ) \right ){b}^{2}}{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)^4*(a+b*tan(d*x+c))^2,x)

[Out]

1/5*b^2*tan(d*x+c)^5/d+1/2*a*b*tan(d*x+c)^4/d+1/3*a^2*tan(d*x+c)^3/d-1/3/d*tan(d*x+c)^3*b^2-a*b*tan(d*x+c)^2/d
-a^2*tan(d*x+c)/d+b^2*tan(d*x+c)/d+1/d*a*b*ln(1+tan(d*x+c)^2)+1/d*a^2*arctan(tan(d*x+c))-1/d*arctan(tan(d*x+c)
)*b^2

________________________________________________________________________________________

Maxima [A]  time = 1.67893, size = 149, normalized size = 1.24 \begin{align*} \frac{6 \, b^{2} \tan \left (d x + c\right )^{5} + 15 \, a b \tan \left (d x + c\right )^{4} - 30 \, a b \tan \left (d x + c\right )^{2} + 10 \,{\left (a^{2} - b^{2}\right )} \tan \left (d x + c\right )^{3} + 30 \, a b \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 30 \,{\left (a^{2} - b^{2}\right )}{\left (d x + c\right )} - 30 \,{\left (a^{2} - b^{2}\right )} \tan \left (d x + c\right )}{30 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/30*(6*b^2*tan(d*x + c)^5 + 15*a*b*tan(d*x + c)^4 - 30*a*b*tan(d*x + c)^2 + 10*(a^2 - b^2)*tan(d*x + c)^3 + 3
0*a*b*log(tan(d*x + c)^2 + 1) + 30*(a^2 - b^2)*(d*x + c) - 30*(a^2 - b^2)*tan(d*x + c))/d

________________________________________________________________________________________

Fricas [A]  time = 1.73293, size = 269, normalized size = 2.24 \begin{align*} \frac{6 \, b^{2} \tan \left (d x + c\right )^{5} + 15 \, a b \tan \left (d x + c\right )^{4} - 30 \, a b \tan \left (d x + c\right )^{2} + 10 \,{\left (a^{2} - b^{2}\right )} \tan \left (d x + c\right )^{3} + 30 \,{\left (a^{2} - b^{2}\right )} d x - 30 \, a b \log \left (\frac{1}{\tan \left (d x + c\right )^{2} + 1}\right ) - 30 \,{\left (a^{2} - b^{2}\right )} \tan \left (d x + c\right )}{30 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

1/30*(6*b^2*tan(d*x + c)^5 + 15*a*b*tan(d*x + c)^4 - 30*a*b*tan(d*x + c)^2 + 10*(a^2 - b^2)*tan(d*x + c)^3 + 3
0*(a^2 - b^2)*d*x - 30*a*b*log(1/(tan(d*x + c)^2 + 1)) - 30*(a^2 - b^2)*tan(d*x + c))/d

________________________________________________________________________________________

Sympy [A]  time = 0.836585, size = 139, normalized size = 1.16 \begin{align*} \begin{cases} a^{2} x + \frac{a^{2} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac{a^{2} \tan{\left (c + d x \right )}}{d} + \frac{a b \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac{a b \tan ^{4}{\left (c + d x \right )}}{2 d} - \frac{a b \tan ^{2}{\left (c + d x \right )}}{d} - b^{2} x + \frac{b^{2} \tan ^{5}{\left (c + d x \right )}}{5 d} - \frac{b^{2} \tan ^{3}{\left (c + d x \right )}}{3 d} + \frac{b^{2} \tan{\left (c + d x \right )}}{d} & \text{for}\: d \neq 0 \\x \left (a + b \tan{\left (c \right )}\right )^{2} \tan ^{4}{\left (c \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)**4*(a+b*tan(d*x+c))**2,x)

[Out]

Piecewise((a**2*x + a**2*tan(c + d*x)**3/(3*d) - a**2*tan(c + d*x)/d + a*b*log(tan(c + d*x)**2 + 1)/d + a*b*ta
n(c + d*x)**4/(2*d) - a*b*tan(c + d*x)**2/d - b**2*x + b**2*tan(c + d*x)**5/(5*d) - b**2*tan(c + d*x)**3/(3*d)
 + b**2*tan(c + d*x)/d, Ne(d, 0)), (x*(a + b*tan(c))**2*tan(c)**4, True))

________________________________________________________________________________________

Giac [B]  time = 5.07415, size = 1775, normalized size = 14.79 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

1/30*(30*a^2*d*x*tan(d*x)^5*tan(c)^5 - 30*b^2*d*x*tan(d*x)^5*tan(c)^5 - 30*a*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^
4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)^5*tan(c
)^5 - 150*a^2*d*x*tan(d*x)^4*tan(c)^4 + 150*b^2*d*x*tan(d*x)^4*tan(c)^4 - 45*a*b*tan(d*x)^5*tan(c)^5 + 150*a*b
*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*
x)*tan(c) + 1))*tan(d*x)^4*tan(c)^4 + 30*a^2*tan(d*x)^5*tan(c)^4 - 30*b^2*tan(d*x)^5*tan(c)^4 + 30*a^2*tan(d*x
)^4*tan(c)^5 - 30*b^2*tan(d*x)^4*tan(c)^5 + 300*a^2*d*x*tan(d*x)^3*tan(c)^3 - 300*b^2*d*x*tan(d*x)^3*tan(c)^3
- 30*a*b*tan(d*x)^5*tan(c)^3 + 165*a*b*tan(d*x)^4*tan(c)^4 - 30*a*b*tan(d*x)^3*tan(c)^5 - 10*a^2*tan(d*x)^5*ta
n(c)^2 + 10*b^2*tan(d*x)^5*tan(c)^2 - 300*a*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c)
+ tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)^3*tan(c)^3 - 150*a^2*tan(d*x)^4*tan(c)^3
 + 150*b^2*tan(d*x)^4*tan(c)^3 - 150*a^2*tan(d*x)^3*tan(c)^4 + 150*b^2*tan(d*x)^3*tan(c)^4 - 10*a^2*tan(d*x)^2
*tan(c)^5 + 10*b^2*tan(d*x)^2*tan(c)^5 + 15*a*b*tan(d*x)^5*tan(c) - 300*a^2*d*x*tan(d*x)^2*tan(c)^2 + 300*b^2*
d*x*tan(d*x)^2*tan(c)^2 + 150*a*b*tan(d*x)^4*tan(c)^2 - 180*a*b*tan(d*x)^3*tan(c)^3 + 150*a*b*tan(d*x)^2*tan(c
)^4 + 15*a*b*tan(d*x)*tan(c)^5 - 6*b^2*tan(d*x)^5 + 20*a^2*tan(d*x)^4*tan(c) - 50*b^2*tan(d*x)^4*tan(c) + 300*
a*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan
(d*x)*tan(c) + 1))*tan(d*x)^2*tan(c)^2 + 240*a^2*tan(d*x)^3*tan(c)^2 - 300*b^2*tan(d*x)^3*tan(c)^2 + 240*a^2*t
an(d*x)^2*tan(c)^3 - 300*b^2*tan(d*x)^2*tan(c)^3 + 20*a^2*tan(d*x)*tan(c)^4 - 50*b^2*tan(d*x)*tan(c)^4 - 6*b^2
*tan(c)^5 - 15*a*b*tan(d*x)^4 + 150*a^2*d*x*tan(d*x)*tan(c) - 150*b^2*d*x*tan(d*x)*tan(c) - 150*a*b*tan(d*x)^3
*tan(c) + 180*a*b*tan(d*x)^2*tan(c)^2 - 150*a*b*tan(d*x)*tan(c)^3 - 15*a*b*tan(c)^4 - 10*a^2*tan(d*x)^3 + 10*b
^2*tan(d*x)^3 - 150*a*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2
+ tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)*tan(c) - 150*a^2*tan(d*x)^2*tan(c) + 150*b^2*tan(d*x)^2*tan(c)
 - 150*a^2*tan(d*x)*tan(c)^2 + 150*b^2*tan(d*x)*tan(c)^2 - 10*a^2*tan(c)^3 + 10*b^2*tan(c)^3 - 30*a^2*d*x + 30
*b^2*d*x + 30*a*b*tan(d*x)^2 - 165*a*b*tan(d*x)*tan(c) + 30*a*b*tan(c)^2 + 30*a*b*log(4*(tan(c)^2 + 1)/(tan(d*
x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)) + 30*a^2*tan(
d*x) - 30*b^2*tan(d*x) + 30*a^2*tan(c) - 30*b^2*tan(c) + 45*a*b)/(d*tan(d*x)^5*tan(c)^5 - 5*d*tan(d*x)^4*tan(c
)^4 + 10*d*tan(d*x)^3*tan(c)^3 - 10*d*tan(d*x)^2*tan(c)^2 + 5*d*tan(d*x)*tan(c) - d)